/*
 * @Author: chengjiang
 * @Date: 2025-06-11 23:38:23
 * @Description:
 */
// Package tools @author <chengjiang@buffalo-robot.com>
// @date 2023/2/20
// @note
package tools

import (
	"fmt"
	"time"
)

func Time2String(ti *time.Time) string {
	if ti != nil {
		// return ti.Format("2006-01-02 15:04:05")
		return ti.Format(time.DateTime)
	} else {
		return ""
	}
}

// 计算接口耗时
func CalcTime() func() {
	start := time.Now()
	return func() {
		fmt.Printf("耗时：%v\n", time.Since(start).String())
	}
}